import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:palyer/app/components/custom_app_bar.dart';
import 'package:palyer/app/core/values/dimens.dart';
import 'package:palyer/app/core/values/gaps.dart';

import 'package:palyer/app/modules/auth/login/controller.dart';

class LoginPage extends StatelessWidget {
  LoginPage({Key? key}) : super(key: key);

  final controller = Get.put(LoginController());
  final states = Get.find<LoginController>().states;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CustomAppBar(
        automaticallyImplyLeading: false,
        centerTitle: true,
        title: const Text('Login'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            AppGaps.vGap50,
            Text(
              'Login',
              style: TextStyle(
                fontSize: AppDimens.sp58,
                shadows: [
                  Shadow(
                    blurRadius: 3.0,
                    color: Theme.of(context).primaryColor,
                    offset: const Offset(0, 0),
                  ),
                ],
              ),
            ),
            AppGaps.vGap50,
            const Padding(
              padding: EdgeInsets.all(8.0),
              child: CupertinoTextField(
                // controller: states.usernameController,
                placeholder: '请输入用户名',
                prefix: Icon(Icons.person),
              ),
            ),
            AppGaps.vGap50,
            const Padding(
              padding: EdgeInsets.all(8.0),
              child: CupertinoTextField(
                // controller: states.passwordController,
                placeholder: '请输入密码',
                prefix: Icon(Icons.lock),
              ),
            ),
            AppGaps.vGap50,
            SizedBox(
              width: 300,
              child: ElevatedButton(
                onPressed: controller.toHome,
                child: const Text('登录',
                    style: TextStyle(
                      fontSize: 32,
                    )),
              ),
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          Get.toNamed('/auth/register');
        },
        tooltip: '注册',
        child: const Icon(Icons.app_registration),
      ),
    );
  }
}
